package com.aipp.mall.h5.controller;

import com.aipp.mall.common.anno.Note;
import com.aipp.mall.h5.domain.vo.H5LoginVO;
import com.aipp.mall.h5.domain.vo.MemberVO;
import com.aipp.mall.h5.service.H5MemberService;
import jakarta.annotation.Resource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * 会员接口
 * @author cc
 */
@RestController
@RequestMapping("/h5")
public class H5MemberController {

    @Resource
    private H5MemberService h5MemberService;

    @PostMapping("/wechat/login")
    public ResponseEntity<H5LoginVO> wechatLogin(String data) {
        return ResponseEntity.ok(h5MemberService.wechatLogin(data));
    }

    @Note("sms登录")
    @PostMapping("/sms/login")
    public ResponseEntity<H5LoginVO> smsLogin(@RequestBody String data) {
        return ResponseEntity.ok(h5MemberService.smsLogin(data));
    }

    @Note("获取会员信息")
    @GetMapping("/member/info")
    public ResponseEntity<MemberVO> getMemberInfo() {
        return ResponseEntity.ok(h5MemberService.getMemberInfo());
    }

    @Note("设置会员微信信息")
    @PostMapping("/member/setWechatInfo")
    public void setWechatInfo(@RequestBody String data) {
        h5MemberService.setWechatInfo(data);
    }

    }

